Py.Cafe

banana0000/

NYC open map

Interactive Color Update with Dash

DocsPricing
  • data/
  • pages/
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import dash
import dash_bootstrap_components as dbc
from dash import Dash, html, dcc

app = Dash(__name__, external_stylesheets=[dbc.themes.DARKLY], use_pages=True)

app.layout = html.Div([
    dcc.Location(id="url", refresh=False),  # URL monitor, de nem kell JS átirányítás

    # Navigációs sáv
    dbc.Nav(
        children=[
            dbc.NavLink("Home", href="/"),  # Új kezdőlap
            dbc.NavLink("Postal Codes", href="/choropleth"),
            dbc.NavLink("Buildings", href="/scatter"),
        ],
        pills=True,
        style={
            "background": "linear-gradient(90deg, red, blue)", 
            "height": "100px",
            "font-size": "40px"
        },
        className="ms-auto"
    ),
    html.Br(),

    # Az oldal tartalma
    dash.page_container,
])

if __name__ == "__main__":
    app.run(debug=True)